package com.zhangsr.zk.client;

import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.data.Stat;

import java.io.IOException;

/**
 * @Author: zhangsr
 */
public interface IZkConnection {

    void connect(Watcher watcher) throws IOException;

    void close() throws InterruptedException;

    boolean exists(final String path, final boolean watch) throws KeeperException, InterruptedException;

    String create(String path, byte[] data, CreateMode mode) throws KeeperException, InterruptedException;

    byte[] readData(String path, Stat stat, boolean watch) throws KeeperException, InterruptedException;

}
